The Ideal Gas Law may be derived from the molecular motion of the gas, if we imagine that the molecules move around roughly like billiard balls on a pool table -- with no forces acting between one molecule and another.
Real gases do have forces acting between the molecules, arising from electrostatic interactions between the charged particles In the atoms. These forces can even make the gas condense wen the molecules have low enough energy and are pushed close enough together; that's why cooling or compressing a gas could turn it into a liquid.
Those electrostatic interactions are stronger if the molecule in inherently polar, with some separation of positive and negative charges built into the molecule. Ammonia does that; notrogen, hydrogen and methane do not. Not only does this make ammonia deviate more from the Ideal Gas Law when It's a gas, it also causes ammonia to condense to a liquid at higher temperature or than nitrogen, hydrogen or methane.