Greenhouse Gases (GHGs) refer to any atmospheric gases that absorb long wave radiation (emitted from the surface), thereby causing the planet’s surface to be warmer than it would be otherwise. These gases include water vapour, CO2, CH4, N2O, many CFCs (chloro-fluro-carbons). Ozone (O3) as well as being a shortwave absorber (in the ultra-violet range) also has a small longwave greenhouse effect. Other components of the atmosphere also absorb longwave radition (specifically aerosols and clouds) and hence have a greenhouse effect while not being gases themselves.
Oxygen (O2) and nitrogen (N2) while being the dominant gases in the atmosphere do not have significant absorption lines in the relevant longwave range and so are not greenhouse gases.