When can you begin a sentence with "but"?

In formal writing, you can never begin a sentence with "But."

It's a conjunction and used to join ideas within a sentence. However, in more informal writing, it's sometimes accepted.

http://grammar.ccc.commnet.edu/grammar/conjunctions.htm