A grating with N parallel slits splits light into spectral orders. White light fans into rainbows at specific angles. More slits make sharper spectral lines -- like a CD or DVD surface.
Where d = grating spacing, m = order (0, ±1, ±2, ...). The grating equation determines where each wavelength appears.