When X-rays interact with these crystalline materials, they diffract the radiation a different amount depending on the distance between the atom and its neighbours. When many X-rays interact, these many diffractions build up a pattern that allows us to see how the atoms are arranged in the solid. Since different sized atoms result in different sized gaps between the atoms in the structure, which changes this diffraction pattern.
The arrangement, or ‘packing’ of the atoms results in the main pattern of the resulting diffraction. If you think about how you could stack ping pong balls in a plasic tube, or stack apples on a table, that gives you an idea of different crystal structures that might be possible. The basic crystal structures are shown below.