To do this, you first have to CID Unlock the phone. By doing this then you can install any rom you want on the device. But before you do that, you need to determine if your phone is a G3 or G4.
If you are interested in doing this, I'd advise you to read:
http://forum.xda-developers.com/showthread.php?t=298613
Once you figure this stuff out, you can upgrade to Windows Mobile 6 or a host of custom roms that are all MUCH better than the stock T-Mobile and Cingular/AT&T roms. Try out my
XDA Mobile 6 rom if you want to take your phone to the next level