Based on the colors you gave, I could guess...but it would be just that, a guess. I don't suppose you have an electrical tester? If not, get one...even a cheap-o, "hot or not" tester will work.
Find a nuetral and expose it.
First off, I should say that between every test, you SHOULD (not saying I would, but I should, as you should) turn off the breaker to this circuit. So, now I'll continue.
Breaker off - Remove (from switches) and seperate all 3 conductors plus a nuetral.
(Adult "spotter" in place to keep curious children away)
Breaker on - Test each conductor to nuetral. The one that lights the tester is the one that goes on the common terminal. The other 2 go on traveler terminals.
Breaker still off - Remove and seperate as above.
Breaker on - Test each conductor to nuetral while working switch number one. The one that does NOT at any time, light the tester is the one that goes on the common this time. The two that did (hopefully) light the tester, one at a time, depending on switch one's position, go on the two traveler terminals.
Now, the "first" switch could be either one, but with ALL conductors removed only ONE, SINGLE conductor should have power. That is the common terminal conductor at, what I was calling, switch one.
Sounds like a three way not a two way. You have a three way dimmer any way. You need to identify the common wire. It is the one that was connected to the black screw on the old switch. That one connects to the black wire on the dimmer.