A communicator is a personal handheld communications device which allowed for a person to communicate with another person over great distances - such as person to person, or person to ship or other installation. Communicators used subspace radio to transmit messages.
Starfleet used communicators as communications devices when a person was away from the ship, or in situations on board a ship or installation where the comm system was not usable or there was a need to avoid using the comm. (TOS episode: "Mirror, Mirror")
In the 2270s and 2280s Starfleet experimented with using a communicator which was worn on a person's wrist. As well as a perscan device (inside the 2270s uniform belt) that monitors and saves its wearer's current life signs. However, Starfleet discontinued that and the wrist communicator when it was found the devices were prone to failure after even a minor impact, and returned to a flip-top design. (TOS reference: Mr. Scott's Guide to the Enterprise, TOS novel: Ex Machina)
By the 2340s, communications technology had advanced to the point that Starfleet was able to build a communication device into the uniform insignia pin. This device, called a combadge quickly replaced communicators as a means of communication between members of Starfleet. (TNG episode: "Yesterday's Enterprise") Benjamin Sisko was so used to the combadge that when he traveled back to the 23rd century USS Enterprise, he tapped the uniform insignia on his shirt out of habit before remembering the need to use his communicator instead. (DS9 episode: "Trials and Tribble-ations")
Communicators were still used occasionally when a higher power level was needed to break through a jamming field, and the USS Enterprise-D carried a number of these communicators. (TNG novel: Foreign Foes)
In the Dark Mirror version of the Terran Empire, communicators were not used by individual personnel, as that would make them too easy to locate and (presumably) kill; all communications were handled by the ship's computer.
The novel Q-in-Law, set in 2366, reveals that Q's combadge actually functions as any standard-issue Starfleet communicator. When hailed by Captain Picard as "Mr. Q," to report to command staff for a meeting-even the omnipotent, omniscient Q is taken off guard.