Hydrogen bonding is a type of attractive interaction between a hydrogen atom, which is covalently bonded to a highly electronegative atom, and another electronegative atom. This interaction plays a crucial role in stabilizing the structures of nucleic acids, influencing their shape and the way they interact with other biomolecules, especially in terms of base pairing in DNA and RNA.