Everything is legal until Parliament passes a law saying that it isn't . (OK, pedants will point out that there are a few 'common law' offences, such as murder, which Parliament has never made illegal - since it was already regarded as illegal when Parliament was first created. However that's not relevant here).
So, until Parliament creates a law saying 'XYZ' is illegal (or the Home Secretary uses exising laws to add 'XYZ' to a list of illegal substances) 'XYZ' will always be legal. 'XYZ' might be risk-free, have very limited risks or be highly dangerous. It makes no difference; until Parliament (or the Home Secretary) has made it illegal, anyone can sell it or use it.
So anything that acts as a stimulant (or sedative or hallucinogenic), and that nobody has yet made illegal, is a 'legal high'. Your local supermarket, for example, sells a remarkably powerful hallucinogenic substance (and which people have died from overdosing on), which you might have bought yourself. It's called 'nutmeg'. (Similarly, the caffeine in coffee, or which is added to many fizzy drinks , could be classed as a 'legal high'. Again, people have died through consuming too much of it).
Fairly obviously, the types of 'legal highs' sold in night clubs, etc, are unlikey to involve nutmeg or caffeine. They tend to be drugs that have been developed for various purposes (such as use by vets to treat horses) or other substances that people have found gives them a high. (Do you remember when glue-sniffing was all the rage? That was a very basic, but still potentially lethal, example of a 'legal high'). Some of them are synthetic drugs which have been deliberately designed to emulate the effects of illegal drugs.
There's some general information here:
http://www.talktofrank.com/drug/legal-highs