Comet
A comet is a randomly created celestial body usually in orbit around Kerbol, although sometimes they can be found simply passing through the Kerbol System. They first appeared in the game with the release of the Shared Horizons update, or 1.10.
Comets can be found and monitored via the tracking station.
Like asteroids, comets are fully under control of the physics system. They can be rotated or accelerated by the application of torque or thrust, and moved into a different orbit or another body's sphere of influence with correct maneuvering. They do not have SOIs of their own or produce gravity to affect nearby objects; they may not be landed on by craft, stood on by kerbals on EVA, or have flags planted on them, but may be docked with through the use of the Advanced Grabbing Unit.
Comets can be much larger that Asteroids with their classes being Class F: "Huge", Class G: "Massive", Class H: "Gargantuine", or, the largest, Class I: "Gargantuine". Typically, class I is restricted only to "Interstellar" comets, which are already really rare, but most of the time, Interstellar comets in KSP are class H, making a class I "Interstellar" comet one of the rarest things in the game. Their occasional immense size and mass makes them difficult to maneuver with ordinary ships; they are slow to turn and usually extremely heavy. They become even more challenging with their high inclination orbits and highly elliptical orbits, which make it so that you may only get one shot or have to wait for hundreds of years, so if you want to move a comet, you might wanna aim for one of the smaller ones. Fortunately, Kerbals are immortal which means that can survive the ride and as they approach the Kerbol they are in for a great show with two beautiful tails coming off the comet.
Note: of the two tails every comet has when in close proximity to Kerbol (Usually just outside of Duna's orbit is when they will start generating the tails), the colored one (which is usually a dark blue) seems to have a chance of being different colors, though miniscule. In fact, the only other color that I've ever seen is just a lighter shade of blue, making light blue or cyan.
Just like asteroids, you can take samples of comets. The way the sample works is the same as asteroids, too-if you're in orbit of the sun, and move to orbit of kerbin, you can get 2 different samples worth more/less/equal science to each other.
History
Comets were added in version 1.10 of Kerbal Space Program. This update also brought a lot of new features in collaboration with the ESA.
Capturing comets
Once a comet is captured with the Advanced Grabbing Unit, it is considered part of the ship. It can be renamed when docked, and/or the craft can then use its engines to alter its orbit. This can be used to get it into a stable orbit around Kerbin or another celestial body, or even drop it into the atmosphere and land it. Capturing a comet requires a procedure similar to docking.
The rendezvous is identical to the usual docking- the comet is targeted and orbits are matched. On close approach instead of targeting a specific docking port the center of mass of the comet may be targeted, and the Advanced Grabbing Unit can attach to the comet's surface at any point. Perfect accuracy is not crucial because the Advanced Grabbing Unit can be tilted after contact to align the craft's thrust with center of mass.
Being as heavy as they are, if you intend to move a comet it is advisable to mine it for extra fuel, with the helpful side-effect of lowering the comet's mass.
EVA construction
You can attach struts, science modules, and other surface-mount parts to a comet with an Engineer the same way you can to any other part, although the parts may attach in odd-looking ways.