What rank is the highest in a military base?

For British Commonwealth nations:

Field Marshal (Army)
Admiral of the Fleet (Navy)
Air Marshal (Air Force)

Also, the question makes no real sense; there is no special rank limitation when "in a military base". That is, militaries don't somehow limit higher rank individuals from entering a base, nor do they somehow reduce their authority for being in "excess" of some rank.

If the question asks "what is the typical rank of the commander of a military base", then, that too is much too nonspecific, as the rank of the base commander depends on a whole host of qualifications, not the least being the size of the base, the military formation(s) deployed at the base, the particular branch overseeing the base, etc.

Also, note that military command structures are not just about rank, but also about the RELATIONSHIP between commands. Thus, it trivial for a visitor to a base to outrank the base commander, but still not be able to order the base commander to do anything (as that visitor is probably not part of the base commander's chain of command).