TFS uses same MSBuild 3.5 under the hood for automatic builds that Visual Studio 2008 uses locally. TFS defines its own build sequence by supplying MSBuild with a .proj file that imports TFS-specific targets and enriches the build sequence of the solution with the features useful in the Team environment (i.e. get latest version from source control, do the build, create TFS ticket if build fails etc.)
Here's my attempt at making sense of all these build frameworks by providing historical perspective: (my guesses and assumptions may be invalid but should still be useful conceptual info for noobs). Checkout the last section called "TFS-related MSBuild concepts" -- it has some useful links.