Here's an example of the wp_title filter in action, taken from the WordPress SEO plugin by Yoast:
add_filter('wp_title', array(&$this, 'wpseo_title'), 10, 3);
First, he hooks into the wp_title filter with the wpseo_title function. Note that in this case, he's doing this inside a PHP object (class), which is why you see array(&$this, 'wpseo_title'). If this weren't inside a class, you would just use wpseo_title as the function name.
Then he defines his wpseo_title function with all of his different paramaters. Chances are that what you are trying to achieve is a lot simpler than this.
[Code moderated as per the Forum Rules. Please use the pastebin]
More on hooks and filters here: http://codex.wordpress.org/Plugin_API#Hooks.2C_Actions_and_Filters
The codex can be a bit disorganized at times, but if you search well enough, you'll almost always find what you are looking for. Better yet, is to look at the WordPress source directly. Of course, you'll need an understanding of PHP to do that.