A spectrograph splits or disperses light into its spectrum so it can be recorded and analysed. This can be done by using a prism or a diffraction grating.
According to the Australia Telescope National Facility, a prism changes the light's angle of bending to create colors out of white light, while diffraction uses an obstacle to spread the beam of white light into colors. The spectrograph allows light to become a wavelength fingerprint of an object, and from that a person can determine temperature, density, chemical composition and motion. Scientists use this data to search for black holes and discover new things about the universe.