This code calculates various directional derivatives of the image - x/y are first directional derivative, xx/yy/xy are second derivatives. The digital filter used for derivation is a 2D Gaussian of standard variation sigma, derived by the appropriate partial derivative (for example, in the case 'xx', the Gaussian is derived twice by x). From your question, I'm not sure you're familiar with the notion of a partial derivative, you can Google it. ndgrid is used to create grid matrices - this is a very commonly used approach in Matlab. Perhaps you know the function meshgrid, it is the same, only ndgrid can also create grid matrices of higher dimensions.
imfilter is used to perform a convolution (correlation to be more precise) between the digital filters to the image. The result of the this is an estimation of the required derivative.