A spectrograph is an instrument used to separate and measure the wavelengths present in Electromagnetic radiation and to measure the relative amounts of radiation at each wavelength. In other words obtain and record the spectral content of light or its ‘spectrum’. The spectrograph splits or disperses the light from an object into its component wavelengths so that it can be recorded then analyzed.
Light entering a spectrograph can be split or dispersed into a spectrum by one of two means, using a prism or a diffraction grating. When Newton split light into a spectrum in the 1660s he used a glass prism in a similar manner show in the diagram below.
This effect arises due to the fact that the different wavelengths of light also have different wavelengths or energies. As they pass through a prism, they undergo refraction, a change in velocity due to the change in medium. If the light falls incident to the prism at an angle other than 90° it will also change direction. Blue light has a shorter wavelength than red light so its angle of refraction is higher, both at entry to and exit from the prism. This means it gets bent more. The effect is the same effect which generates a rainbow in a rain shower, with the droplets of rain acting as prism to disperse or split the light into its component colors.