Different width of spectral lines for different groups of stars

As seen in an HR-diagram, a certain stellar classification can correspond to more than one group/sequence of stars (G5 could for instance be either a giant, main sequence star or a white dwarf and so on). I have read in my textbook that even though these groups might have the same absorption spectrum, they can be distinguished by the thickness of their absorption-lines. For instance, giants have narrow lines and dwarfs broad ones. What is the physical explanation of this?

Many of the strongest spectral lines (e.g. Balmer absorption lines and resonance lines of metals) are very sensitive to the surface gravity of the star. This enables a distinction between dwarfs and giants because a giant star's surface gravity is factors of $$\sim 100$$ lower than that of a dwarf star of the same temperature.