The phosphate and the pentose groups are the same in every nucleotide that forms the nucleic acid and so they give homogeneity to the molecule. The nitrogen-containing bases however can vary among adenine, thymine, cytosine, guanine (in DNA) and uracil (in RNA). These variations provide the heterogeneity of the nucleic acid molecule.
Homogeneous portions of a molecule seldom would store any information, by the same reason that a sequence of the same letter of the alphabet cannot make many words with different meanings. The nitrogen-containing bases, on the other hand, because of they are different (four different types for RNA or DNA), can make different sequences and combinations that allow the diversity of the genetic code.