The matchit.vim script allows you to configure % to match more than just single characters. You can match words and even regular expressions. Also, matching treats strings and comments (as recognized by the syntax highlighting mechanism) intelligently.

Matchit is included in the Vim standard distribution since version 6, but it's not enabled by default.

The version at Vim scripts is usually more up to date, so you probably want that one. Unzip it in your ~/.vim directory.
To use the version included with Vim copy $VIMRUNTIME/macros/matchit.vim to ~/.vim/plugin and $VIMRUNTIME/macros/matchit.txt to ~/.vim/doc.

Rebuild the help tags with :helptags ~/.vim/doc

For example, you can now use % and g% to cycle back and forth between if and fi in shell scripts.

See :help matchit-install for more information on installing matchit. After installation you can use :help matchit for usage information.