First off, the original question:
What are the differences between "agree on", "agree with" and "agree to"?
'Agree' without a preposition is grammatically invalid.
'Agree on' implies the object will be an idea that will satisfy the agreeing parties.
They agreed on the terms of the contract.
'Agree with' implies that the subject of the verb is in agreement with something the object of the verb has previously proposed, stated, or otherwise brought up. Depending on the context, this 'agree' may imply that the subject states their agreement as part of agreeing.
Joseph said, "Let's go to lunch!"
Bill agreed with Joseph.
'Agree to' can be used to state that the agreeing parties have settled on a course of action,
They agreed to go to Montreal.
And because of this, it can be used on documents, implying the agreer is in agreement with the statements in it:
Barbara agreed to the contract.
If you were to use 'agree with the contract', that would not imply that it was binding, just that the agreer thought its terms made sense. 'Agree on the contract' is grammatically incorrect, as is 'agree the contract'. Only 'agree to the contract' implies that the contract binds the agreer.