From the Charities Act 2011
A "charity" is an institution which is established for charitable purposes only
It then lists charitable purposes:
A purpose falls within this subsection if it falls within any of
the following descriptions of purposes—
(a) the prevention or relief of poverty;
(b) the advancement of education;
(c) the advancement of religion;
(d) the advancement of health or the saving of lives;
(e) the advancement of citizenship or community development;
(f) the advancement of the arts, culture, heritage or science;
(g) the advancement of amateur sport;
(h) the advancement of human rights, conflict resolution or
reconciliation or the promotion of religious or racial harmony or
equality and diversity;
(i) the advancement of environmental protection or improvement;
(j) the relief of those in need because of youth, age, ill-health,
disability, financial hardship or other disadvantage;
(k) the advancement of animal welfare;
(l) the promotion of the efficiency of the armed forces of the Crown or
of the efficiency of the police, fire and rescue services or ambulance
services;
(m) any other purposes—
(i) that are not within paragraphs (a) to (l) but are recognised as
charitable purposes by virtue of section 5 (recreational and similar
trusts, etc.) or under the old law,
(ii) that may reasonably be regarded as analogous to, or within the
spirit of, any purposes falling within any of paragraphs (a) to (l) or
sub-paragraph (i), or
(iii) that may reasonably be regarded as analogous to, or within the
spirit of, any purposes which have been recognised, under the law
relating to charities in England and Wales, as falling within
sub-paragraph (ii) or this sub-paragraph.
The act then goes on to clarify some of the terms used above (e.g. "religion"), I'm not going to quote the whole thing.
Futhermore:
In this Act “institution” means an institution whether incorporated or not, and includes a trust or undertaking.
This seems to allow quite a bit of latitude to the types of organizations that may be charities.
When an institution tries to register, the Charity Commission will presumably make the determination whether they're actually a valid charity.
See also Exploring the definition of a charity in the UK.