A diffraction grating is an optical component with a regular pattern that splits and diffracts light into several beams traveling in different directions. The directions of these beams depend on the spacing of the grating and the wavelength of the light.