High resolution x-ray diffraction of periodic surface gratings