Every hot, diffuse cloud of gas in the galaxy is radiating in the same handful of quantum transitions. Hydrogen atoms, stripped of their electrons by nearby O-type stars, recombine and cascade back down, emitting at fixed wavelengths. Doubly-ionized oxygen (OIII) glows at 496 and 501 nm; hydrogen-beta at 486 nm; hydrogen-alpha at 656 nm deep in the red.
Your eye at the eyepiece sees all of that — plus the broad continuum of scattered streetlight, airglow, moon, and your neighbor's porch light. The nebula is a thin signal riding on thick noise.
A narrowband filter solves this by being picky. A good UHC passes a window about 25 nm wide, centered to include both the OIII doublet and H-β. An OIII passes a window of 10–13 nm, tight enough to reject H-β. An H-β passes a 10 nm window centered on 486 nm and nothing else. Starlight, sodium streetlamps, airglow, and moonlight are almost all outside those windows — so they never reach your eye.
Think of it as noise-canceling for light
The nebula's signal is narrow in wavelength; the light pollution is broad. The filter doesn't amplify the nebula — it just silences the noise by a factor of ten or more, and your dark-adapted eye does the rest.