Zak is correct that "if" means it might happen, and "when" means it is going to happen. Because of this, and the subject of the sentence, I would add that you should never say "when your friend breaks up with his girlfriend" unless that friend has already told you they are going to break up with their girlfriend. It would be considered VERY rude. Saying that while your friend still has that girlfriend would be like telling them you know their relationship is going to fail.