I was curious myself and stumbled upon this interesting thread on Airliners.net (
http://www.airliners.net/aviation-fo....main/3407167/).
Boeing doesn't determine this. The determination is made by IATA who publish an annual "Coding Directory" that incorporates all of this and more.
The "W" and "L" in the 77W and 77L don't stand for anything particular. Similarly the "H" in 73H or numerous other examples. These were selected by a committee who probably used similar logic to what was mentioned here when coming up with them, but officially are just random selections.
It seems that they're entirely arbitrary designations made by the IATA. There's a comprehensive listing here (
http://www.airlinecodes.co.uk/arctypes.asp), although it might be out of date since it doesn't show the 77L/77W.