IVs are hidden values that affect your pokemon's levels. An IV of 0 is the worst. At level 100 with an IV of 0, your pokemon will have 31 less points in that stat with the IV of zero. With an IV of 31, your poke loses no points and has the maximum possible (with no EVs, you'd train with EVs to get it higher, but you know that =P)
Therefore, 31 is clearly the ideal.
Every poke has one IV in each of the stats, but you can never see it. You can do nothing to change a pokemon's IVs, they're set. BUT you can breed a new pokemon to have IVs to suit your needs.
When you breed, 3 IVs are passed down from the parents, then the other 3 are made up randomly.
The game first selects a random IV from the parents. Then it selects any random IV that is not HP. Then it selects a random IV that is not HP or Def. (I dunno why it does it, but it was proven on Smogon through the incredible work of a couple people...)
Then the other IVs are made up.
Thats generally the overview of them, there are some good topic in the breeding forum if you want to learn how to breed for them. And don't worry too much about the Hp/Def thing.