Robin: "We should make a pact! If the years go by and we both turn 40 and we're still single-"
(Ted gets up, gets down on one knee and takes Robin's hand)
Ted: "Robin Scherbatsky, will you be my back up wife?"
Robin: (jokingly tearful) "A girl always dreams of hearing those words. Yes! Yes! A million times yes!"
So to paraphrase what it means to make The Ted & Robin Pact, you and somebody special decide that if both of you turn 40 and are still single, then you get together and avoid loneliness.
Of course, it is still within this definition to deviate away from the exact guidelines. Such as changing the age to 35 or even 30. This example is just to put the idea in anybody's mind because anybody may be interested in this "back up plan".
I must, however, state that if you do intend to make this pact with someone or just put the idea out there, please make sure both parties know what level of seriousness you are taking to this conversation. If one person is really serious and the other may just be kidding around, then the outcome could possibly be out of your best interest.