When white light falls onto a diffraction grating, it produces a spectrum with all visible wavelengths separated according to their refractive indices.
A diffraction grating is a plate with many closely separated slits.
When a parallel beam of monochromatic light is directed at the grating along the normal, the beam will split into distinct lines.
The central beam (along the normal) is the zero order beam. On either side, each subsequent beam is the first order, second order, and so on.
Having the slits closer together will increase the angle of refraction between each refracted beam.
Increasing the wavelength of the light will increase the angle of refraction between each refracted beam.
d * sin(theta) = n * (wavelength)
d = separation between individual grates
theta = angle of diffraction of the beam
n = order of the beam (zero, first, second...)
maximum number of orders (n) = d / (wavelength), where n is rounded down to the next whole number.