X-ray diffraction from polycrystalline multilayers with flat interfaces in grazing-incidence geometry