"Canon" isn't a term that is used in comics themselves but still plays a fundamental factor in how the stories are told. Canon is any material in fiction that is accepted as an official part of the mythos.
Spider-Man being bitten by an irradiated spider is canon. Batman's parents being shot dead by a thug called Joe Chill is canon.
But that doesn't mean there isn't alternative versions of these iconic tales. Batman: Gotham by Gaslight is a graphic novel where Bruce Wayne was born in Victorian England. He became Batman after his parents are killed by Jack the Ripper. It's a fantastic story but it's not canonical since it doesn't take place in the official DC universe.
Sometimes, writers create non-canonised stories just to have a bit of fun without contradicting continuity. This practice has led to some astounding series like Superman: Red Son, Kingdom Come, and Batman: Earth One.
It can be confusing since what is considered canon can change. When Captain America's sidekick, Bucky, was blown up in WWII, he was considered canonically dead for decades... until he was resurrected in 2005. Changes like this brings us to another pivotal (but sometimes reviled) word used in comics called...