It also starts the clock for your boss and your company, kicking off the transition plan of training, hiring, and otherwise covering your impending departure. The bad examples here are all too vague. With the last one, you're aligning yourself with company policy, which is good, but it still doesn't tell the reader how much notice that actually is. Be as specific as possible on the time you have between now and your last day.
You want your intent to be as direct as possible. You are leaving, plain and simple. There's no need to mention where you're going. You can discuss that with your boss (though you're not obligated to do so) and your colleagues if you want, but there's little purpose for including that in your resignation letter. That's especially true if you're moving over to a competitor__you don't want to create ill will in this letter or cause any drama.