Montag burns Captain Beatty because Beatty knows that he has been hoarding books and shows up to burn his house and threatens Faber.
After Mildred turns Montag in for having books, Beatty tries to makes him take a flamethrower to his own house. Beatty goads him and Montag knows he will be arrested. The worst part is when he threatens Faber.
"Well--so there's more here than I thought. I saw you tilt your head, listening. First I thought you had a Seashell. But when you turned clever later, I wondered. We'll trace this and drop it on your friend." (Part III)
Montag is frustrated with Beatty, and terrified. He is also worried about the Hound, and knows that his life and Faber’s is in danger. There is no way that Beatty is going to let him go. Beatty is smart, and paradoxically quotes from books constantly in order to goad Montag. He quotes books in order to convince Montag that books are worthless. Even now, at the end, he quotes Shakespeare while disparaging him.
Beatty is no ordinary fireman. He has clearly read the books he burns, or he would not know so much about them. Whether or not Montag realizes this, he attacks Beatty with the flamethrower in self-defense, in fear, and in reflex. He is holding a flamethrower, and Beatty is a threat. Montag did not plan this.
Thinking back later he could never decide whether the hands or Beatty's reaction to the hands gave him the final push toward murder. (Part III)
In the end, Montag has to run after this incident. He decides to take off toward Faber and the book people. He is on his own, since his wife has betrayed him and his life as his knew it is over. He also has realized that the society he has known is not the one he wants to be a part of, and he wants to begin fresh in another one. He will get that chance, as the old one destroys itself. He got out just in time.