I'm sure differing Lightsaber colors originally came about to make dueling scenes easier to follow, and keep the guys doing the rotoscope FX from going insane. Now, it's probably a couple mouse clicks and done. ;)
Vader's was actually blue in McQuarrie's early conception.
In universe, I would think a Lightsaber color is purely a personal preference. There has to be a switch on the hilt for that somewhere?
It gets better than that: the text of GL's 1974 rough draft of The Star Wars describes only one lightsaber color, and that is red. And the lightsaber thus described is that of the protagonist!
Although the initial idea was to give everyone red sabers, early effects tests (glimpsed on the Blu-ray) show that ILM considered using all-blue, all-white, and all-red sabers. The all-white sabers were what GL picked--possibly after reading a SF story by Edmond Hamilton featuring white "lightswords," a term which may have helped GL abandon his use of "lazersword" in earlier drafts--and they can be seen in all their ugliness in the original trailer.
The failure of the original attempt to realize the lightsabers' glow in-camera meant that a new rotoscope effect had to be devised in post. It's at this point that GL probably remembered reading Lord of the Rings and the scene where Gandalf wields the blue-glowing Elvish sword Glamdring against the flaming red sword of the Balrog.
McQuarrie certainly seems to have devised the idea of different saber colors earlier, but even after agreeing to it Lucas didn't follow his choice of colors (yellow for the hero, blue for the villain, and white for stormtroopers!).
Even after the finalization of the effect, the idea of uniformly colored sabers didn't stop: one of McQuarrie's concepts for the cover of the SW novelization (a second take on his famous painting of the second draft's Deak Starkiller/Vader duel) shows all-white sabers. The Marvel adaptation of SW used all-red sabers. And Splinter of the Mind's Eye and the ESB novelization both describe Vader's saber as blue as well as Luke's.