The boolean gun was a type of large and bulky hand-held directed energy weapon used by Khan Noonien Singh, a former operative of Section 31 of Starfleet. Despite its size, the weapon could be operated with a single hand and was carried with a shoulder strap.
When activated, the boolean gun produced powerful bright streams of energy and a loud roaring noise. The energy streams could slice through and vaporize holes into anything they were targeted at, from personnel to starship hulls. (Star Trek Into Darkness)
In 2259 of the alternate reality, Khan Noonien Singh took one of these weapons with him when he used a portable transwarp beaming device to transport himself from Earth to Qo'noS. When Khan discovered that the USS Enterprise was possibly carrying his entire surviving crew of augments from the SS Botany Bay, he defended the away team sent to apprehend him with his boolean gun.
Khan used the gun to attack the Klingon soldiers of three D4 class patrol ships. He used the boolean gun to slice through one of the D4 ships cockpits causing the front end of the small ship to explode. The ship instantly lost altitude, spiraled out of control and crash landed. Khan saved Kirk from a Klingon soldier, who had knocked Kirk down and was standing over him, with his boot on Kirk's face. The boolean gun instantly burnt and vaporized away the upper half of the Klingon soldiers body. Along with a rapid-fire phaser rifle, and a knife, Khan used the boolean gun to take out dozens of Klingon soldiers. He even used the bulky weapon in hand-to-hand combat to knock down a Klingon soldier.
Khan used the gun against another Klingon patrol ship that was in the process of deploying more troops. The beam sliced into the ship causing it to explode mid-air. The wreck explosively crash landed killing all the troops within. He used the boolean gun to massacre several of the remaining Klingons. The weapon instantly burned holes approximately a meter in diameter into the Klingons bodies. Khan dropped the boolean gun behind before killing the last of the surviving Klingons with his other weapons. (Star Trek Into Darkness)
The concept artist John Eaves named his concept image of the weapon as a Klingon heavy disruptor and a gatling gun, suggesting it was originally a Klingon weapon. There was nothing in the movie to suggest it was a weapon obtained from the Klingons.
The term Boolean gun, referencing the Boolean data type, comes from an interview with Pixomondo Visual Effects Supervisor Ben Grossmann. "I think J.J. [Abrams] even said it was like a boolean gun, true/false. If it's on and it hits it, it's gone," Grossman explained.  It was J.J. Abrams who devised this type weapon. Recalling how he did so, Ben Grossman stated, "J.J. one day ran up on set and said he had this great idea for this new gun. Imagine if there was a gun – a really bad-ass gun – [...] that's like a Gatling gun and when it goes off it's kind of like the sound of God clearing its throat – just like 'raaaaaaaaaahh'. The 'boolean gun' development and execution was spearheaded by Look Dev Supervisor Max Reiss." 
To depict the gun obliterating Klingons and Klingon ships, Pixomondo suggested stitching both live action and planned CGI shots. "So we mixed in the work of the special effects team and we did CG takeovers for a lot of that stuff," said Ben Grossman. 
In the novelization of Star Trek Into Darkness, the weapon was also not given a specific official name, but it was referred to as a power rifle. It was according to the novel designed to be mounted on a tripod and manipulated by two or more people. The fact that Khan could wield it with precision and as effortlessly as a light pistol was due to his strength and abilities as an augment.