@Pat Rach an agent could probably explain this better than me, but when a property is "under contract", it means that the buyer and seller have agreed to a contract to sell the property at a certain price (provided certain conditions are met), and which describes all the terms that will govern how the parties will proceed with the sale of the property.
This contract typically includes the terms by which the seller is able to engage in due diligence (e.g.; terms governing how the buyer can inspect the house, check the title of the property, etc.). Importantly, the contract also includes terms that prevent the seller from selling the property to someone else while the contract is in place, and terms that prevent the buyer from exiting the contract except under certain circumstances. Contracts also often include terms related to earnest money, how the buyer will pay the seller, the timeline for the due diligence process, the terms of the inspection (or lack of an inspection), the agreed-upon location, condition, dimensions and features of the property, how much the seller's and buyer's agents will receive, etc., etc.
In a nutshell, the contract lays out what is being sold, for how much it is being sold, and all the terms that govern how the buyer and seller will proceed with the sale--and it also makes it so that the buyer and seller can only back out of the sale under certain conditions (which helps prevent buyers or sellers from "flaking" out of the sale for frivolous reasons).
Except under certain conditions, canceling a contract usually means serious penalties to the seller and/or buyer; these penalties can include financial penalties, legal liability, and also the inherent penalty to both the buyer and seller of lost time, effort and missed opportunity.
Having said that, it is possible for a buyer or seller to cancel a contract. Although you generally want to avoid canceling a contract in most scenarios, and there can be significant penalties for canceling a contract, it is sometimes necessary.
I rarely cancel contracts (mostly because I do pretty solid due diligence before I even make an offer), but I have had a couple instances where I had to cancel contracts--once when my post-contract due diligence discovered serious problems that the seller hadn't disclosed, and another time when a totally unpredictable event significantly changed the value of the property while the property was under contract. In both instances, my reasons for canceling were legitimate, verifiable, and legally sound--and as a result, I didn't have to pay any penalties for the cancellation (other than wasted time, and the disappointment of not getting a property I had been really enthusiastic about)...but, that's the nature of the game sometimes...
Hopefully that's useful info.