The offense varies from jurisdiction to jurisdiction but the essence remains the same: to aid or comfort the state or its agents with which war is engaged, or whether a state of war exists or not, any attempt or conspiracy to harm the head of state.
Title 18 of the United States Code defines treason and gives it the added emphasis that a death penalty tends to add, as follows, at §2381:
"Whoever, owing allegiance to the United States, levies war against them or adheres to their enemies, giving them aid and comfort within the United States or elsewhere, is guilty of treason and shall suffer death, or shall be imprisoned not less than five years and fined under this title but not less than $10,000; and shall be incapable of holding any office under the United States."
Historically, the crime of treason was put into place to define offences against persons of royal birth and to ensure that the harshest penalties were inflicted upon those convicted of attempts on the life of a royal, or a conspiracy thereto. Indeed, England, even as late as 1750, punished any person who "doth ... imagine the death of our lord the king, of our lady his queen, or of their eldest son and heir". The Greek historian Plutarch writes of a Greek ruler who inflicted the death penalty upon a subject who admitted having dreamed of the ruler's death.
The Canadian Criminal Code, at §46, defines "treason" as:
"Every one commits treason who, in Canada, (a) uses force or violence for the purpose of overthrowing the government of Canada or a province; (b) without lawful authority, communicates or makes available to an agent of a state other than Canada, military or scientific information or any sketch, plan, model, article, note or document of a military or scientific character that he knows or ought to know may be used by that state for a purpose prejudicial to the safety or defence of Canada; (c) conspires with any person to commit high treason or to do anything mentioned in paragraph (a); (d) forms an intention to do anything that is high treason or that is mentioned in paragraph (a) and manifests that intention by an overt act; or (e) conspires with any person to do anything mentioned in paragraph (b) or forms an intention to do anything mentioned in paragraph (b) and manifests that intention by an overt act."
In a statutory residue of her creation by England, the crime of high treason, in Canada, is, in part, distinguished in relation to the Queen of England as:
"... (a) kills or attempts to kill Her Majesty, or does her any bodily harm tending to death or destruction, maims or wounds her, or imprisons or restrains her; (b) levies war against Canada or does any act preparatory thereto; or (c) assists an enemy at war with Canada, or any armed forces against whom Canadian Forces are engaged in hostilities, whether or not a state of war exists between Canada and the country whose forces they are."
The Canadian Code contains an interesting little evidenciary tidbit on point where, at §47, it adds:
"No person shall be convicted of high treason or treason on the evidence of only one witness, unless the evidence of that witness is corroborated in a material particular by evidence that implicates the accused."
Similarly, the Australian Criminal Code defers to the person of the British Monarch, in addition to specified members of their domestic and elected heads of state, as follows, at §80.1:
"A person commits an offence, called treason, if the person: (a) causes the death of the Sovereign, the heir apparent of the Sovereign, the consort of the Sovereign, the Governor-General or the Prime Minister; (b) causes harm to the Sovereign, the Governor-General or the Prime Minister resulting in the death of the Sovereign, the Governor-General or the Prime Minister; (c) causes harm to the Sovereign, the Governor-General or the Prime Minister, or imprisons or restrains the Sovereign, the Governor-General or the Prime Minister; (d) levies war, or does any act preparatory to levying war, against the Commonwealth; (e) engages in conduct that assists by any means whatever, with intent to assist, an enemy at war with the Commonwealth, whether or not the existence of a state of war has been declared and specified by Proclamation made for the purpose of this paragraph to be an enemy at war with the Commonwealth; (f) engages in conduct that assists by any means whatever, with intent to assist another country or an organisation that is engaged in armed hostilities against the Australian Defence Force; (g) instigates a person who is not an Australian citizen to make an armed invasion of the Commonwealth or a Territory of the Commonwealth; or (h) forms an intention to do any act referred to in a preceding paragraph and manifests that intention by an overt act."
The English, according to William Blackstone, also held as treason, any violation of:
"... the king's companion or the king's eldest daughter" as treason, or counterfeits the king's seal or money or the murder of a judge. Later, they really got creative holding treason to encompass the act, by a Welshman, of stealing cattle, or of any Englishman who "believed the king (Henry VIII) to be lawfully married to Anne of Cleves".