Multiple scattering in grazing-incidence X-ray diffraction