A security grid was a system in place aboard starships, space stations, and other installations that was responsible for monitoring and maintaining the various systems designed to protect the crew from potentially hostile incursions.
In the 22nd century, the capital city on Vulcan was protected by an extensive security grid, prohibiting the use of transporters without a proper access codes. In 2154, Starfleet captain Jonathan Archer and T'Pau were able to obtain the proper codes from Koss, the husband of Commander T'Pol, Archer's first officer. Gaining access to the chambers of the Vulcan High Command, Archer and T'Pau were able to present the Kir'Shara, a copy of Surak's original teachings. (ENT: "Kir'Shara")
In 2370, Quark circumvented Deep Space 9's security grid to allow access by Yeto, a Klingon mercenary with whom Quark had made a deal for the sale of liquid data chains. It was soon revealed, however, that the deal was simply a ruse to gain access to the Dax symbiont. (DS9: "Invasive Procedures")
In 2376, the crews of the USS Voyager and the USS Equinox collaborated to create an auto-initiating security grid meant to confine any attacking nucleogenic lifeform behind a multiphasic force field the moment one emerged from an interspatial fissure. Before the grid was brought online, however, the Equinox crew stole Voyager's field generator and integrated it into their own systems, for the purpose of continuing their criminal experiments of murdering the lifeforms and converting their remains into a source of fuel. (VOY: "Equinox")
In 2377, the crew of Voyager developed a plan to introduce a nanovirus into the Borg Collective by uploading it into the central plexus of a class-four tactical cube. However, since the central plexus of the cube was protected by multi-regenerative security grids, this necessitated the boarding party allowing themselves to be assimilated into the Collective, thereby allowing them access to the plexus. (VOY: "Unimatrix Zero")