Is there a way to have BBEdit automatically save files when switching to a different application?
BBEdit has "Attachement Point" scripts that are automatically run during different conditions. Here is a list of Attachment Points:

http://www.bbeditextras.org/wiki/index.php?title=Attachment_Points

Here is a script that should do what you want:

https://gist.github.com/benspaulding/1287814