to be honest, it's pretty arbitrary. some people keep bettas in half a gallon, some in a gallon, some in 5, some in 10, and they all report the same results. A betta that APPEARS happy, healthy, and interactive.
The fish itself is 2.5 inches generally, so by the inch rule, 2.5 gallons is the absolute minimum. The fish is not a big waste producer, and small-waste fish are generally allowed to be overstocked slightly because filters can handle that little extra load. And if you over filter your tank, then you can keep even more. The fish also is nowhere near as active as a tetra or a danio.
A tank is overstocked if a fish can't turn around easily, can't swim without bumping into another fish, doesn't have enough swimming room (ie: a danio in a hex tank), or if the filter can't handle the amount of waste produced by the fish and the nitrates begin rising.
That said, yes, you can keep a betta in a three gallon, and even better if it's a filtered three gallon. A dog may live in only a small yard, but it can still be properly stimulated through play and interaction with its surroundings and those within (and without) them.