You read it correctly. Many zoning codes define family in exactly that shape, related persons in any number, or a capped group of unrelated persons, and three or four is a common cap. Four cousins would count as one family under that text and four strangers would not.
On whether it binds: courts in various states have limited or struck down unrelated-occupant caps, some state legislatures have restricted them, and other places enforce them normally. That means the answer is specific to your state and sometimes to your city, and whether a particular cap is enforceable against you is a legal question for a local land use attorney. What you should not do is assume a cap is dead because you read about a case elsewhere.
Two practical steps. Ask the planning or zoning department in writing what the current occupancy standard is at that address, and keep the reply. Separately check whether the town has a rooming house or boarding house category, because some places allow room-by-room rental as its own permitted use with a license and inspection rather than banning it outright. That path can be slower and it can also be the legal way in.
Even where zoning permits it, a homeowners association can restrict or prohibit renting individual rooms through its own covenants, and the HOA documents are a separate thing to read before you buy. Zoning saying yes doesn't mean the recorded covenants say yes.