What are spectrographs used for?
To identify the elements within a source of light.
If you drop the salt on fire you will see a yellow flame.
That color is produced by the sodium of the salt. In particular it is produced by the jump of the electrons of the sodium. This jump is very precise and will release always the same color. It is a sort of a signature unique of the sodium.
The spectrograph is an instrument that takes the "indistinct" light of a star and analyze the colors that are present in that light.
If, for example, it detects the yellow color specific for sodium, we will know that on that star there is a certain quantity of sodium.
Every element has its own specific color that is detected by the spectrograph. The collection of colors produced by a source is called the spectrum of the source (this is why the instrument is called spectrograph).