Start here … http://www.devx.com/dotnet/Article/27673/0 (Site Definitions: How to use them and why you need them.)
It’s written from the perspective of WSS but the same concepts apply to portal. (Look for WEBTEMPSPS.XML in the 60\TEMPLATE\1033\XML directory to see…)