The interaction of X-rays (electromagnetic radiation with wavelengths in the approximate range of 0.1 to 10) with matter produces scattering in all directions. The electrons in the matter oscillate to the electric field of the impinging X-rays so that the scatter will be in the same wavelength and frequency of the impinging X-rays. Under certain conditions (defined by the Bragg equation), parallel rays produced by the scatter reinforce each other to produce a diffracted wave, and this is referred to as X-ray diffraction.
Cf., Bragg equation, unit cell