Atticus explains that Bob Ewell had little choice after he had been disgraced on the witness stand during the Tom Robinson trial.
"Jem, see if you can stand in Bob Ewell's shoes a minute. I destroyed his last shred of dignity at that trial, if he had any to begin with. The man had to have some kind of a comeback, his kind always does. So if spitting in my face and threatening me saved Mayella Ewell one extra beating, that's something I'll gladly take."
Atticus goes on to say that Bob has gotten it all out of his system and there is nothing else to worry about, hoping to erase any fears the children may have. It was typical of Atticus to treat everyone fairly--even someone like Bob--and he wanted his children to understand why Bob made the threats he did.
I think that the answer you are looking for in at the start of Chapter 23. There, Atticus says that the reason Bob Ewell is acting like this is that his pride and credibility has been destroyed by the trial. If he does not do something to fight back, he will lose respect for himself and maybe people will look down on him even more.
I think that Atticus says this for a couple of reasons. First, I think he wants the kids not to be afraid. Second, I think he wants them to see all people, even Ewell, as people who have valid and understandable feelings. He wants them to stand in the other person's shoes and understand their outlook.