If you see the twitter\'s bootstrap application.js file that exists in all documents, you will notice something the following code:
!function( $ ) {
...
This guarantees that in the code inside the function you will be able to use the $ shorthand way of accessing jQuery. In some environments (Wordpress for example), they don't have the $ shorthand "enabled" to avoid conflict with other javascript libraries. By using this way here, you can use the simple $ construct in any environment (as long as window.jQuery is defined).
So, basically it creates a function and immediately calls it, passing in window.jQuery. That means code in the function will see the $ local variable, and it's been assigned window.jQuery.