NetHack has a basic knowledge of elementary physics. Change of state is one piece of that information.
Any substance can come in several forms: solid, liquid and gas. In NetHack, a potion in the inventory might freeze, breaking it, or it might vaporize. These effects take place when, for example, wand of cold or wand of fire hits one. Inhaling the vapors has additional effects depending on the potion.
Change of state can be used for benefit also. You can, for example, freeze a moat to cross it.