If your will is likely to attract IHT, the tax liability is reduced if at least 10% of your estate is left to charity,but bear in mind that only a small percentage of estates are big enough to pay tax (especially now that there's an extra allowance for leaving a house to offspring)
Otherwise I suppose the reason people do it is that it's a painless way of making a difference to causes you care about. Be careful, though, of leaving a percentage of the estate to one or more charities. When this happens, charities have a duty to check up on you and make sure the estate, and the sale of any property etc, is properly managed, to maximise what they receive. If, however, you leave them a fixed sum, they know what they're getting and are less likely to hassle you.
I was an executor to an estate in which a percentage went to four charities. I took the initiative and sent the charities copies of the will, and then kept them informed at every stage (probate, house sale, etc etc). They seemed to appreciate this and gave me no problems.