Grayscale morphology
According to this paper, the grayscale dilation of image $I$ by a non-flat structuring element $S$ is defined as follows:

$[I ⊕ S](x,y) = \displaystyle\max_{(s,t)∈S}\{I(x-s,y-t)+S(s,t)\}$

Since the origin of the structuring element is in the top right corner, we have that $s∈[0,1]$ and $t∈[-2,0]$ excluding the point $(s,t)=(0,-1)$. So using your example of element $I(0,1)$ we have the following:

$[I ⊕ S](0,1)=\max\{I(0,3)+S(0,-2),\ I(-1,3)+S(1,-2),\ I(-1,2)+S(1,-1),\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ I(0,1)+S(0,0),\ I(-1,1)+S(1,0)\}$

$=\max\{0+0,0+0,0+2,2+0,0+(-1)\}=\max\{0,0,2,2,-1\}=2$

Which is the correct value for element $(0,1)$ in the dilated matrix. You can then simply apply the formula to the other $(x,y)$ value pairs of interest to obtain the final result.

The definition of erosion (and the other morphological operations) can also be found in that paper and applied in the same manner.