We present a theoretical study of a new application of the phase-shifted Bragg grating (PSBG) as an optical spatial differentiator operating in reflection. We demonstrate that the PSBG allows to calculate the first-order spatial derivative at oblique incidence and the second-order derivative at normal incidence. As an example, the differentiator is numerically shown to be able to convert an input 2D Gaussian beam into a 2D Hermite-Gaussian mode. We expect the proposed application to be useful for all-optical data processing.