Fungi are immotile eukaryotes that do not have chloroplasts or perform photosynthesis. Yet there are other organisms that fit this definition that are not fungi, for example slime molds. What is the formal definition of a fungus? Wiktionary, Wikipedia, and other dictionaries provide informal definitions.
Formal definitions aren't really a thing in Biology or anywhere outside of mathematics.
For cladistics, the closest you will get is that species are arranged based on common ancestry. Fungi are a group of organisms sharing a common ancestor. This is present, not absent, in the definition on Wikipedia:
These and other differences place fungi in a single group of related organisms, named the Eumycota (true fungi or Eumycetes), that share a common ancestor (i.e. they form a monophyletic group), an interpretation that is also strongly supported by molecular phylogenetics.
If you have some organism and you want to convince other biologists that it should or should not be classified as a fungus, you would want to make arguments about its ancestry.
Before modern molecular biology techniques, these groupings were entirely based on phenotype. Linnaeus is the individual most recognized for classifying organisms this way and many of his conventions and groupings are still used today (though many others have changed, as well). Darwin's contribution to biology was recognizing that the groupings based on phenotypic similarity originate from common descent (that is, shared ancestry). But, even with that knowledge, it's possible to make mistakes in classification based on phenotype alone. When you hear about some organism previously classified one way whose classification has changed, it's likely that the previous classification was based on assumed relationship based on phenotype, but molecular phylogenetic methods have since suggested a different ancestry and therefore a different classification is more appropriate. Because we do not have all the ancestors (or, really, any of them) to examine, these relationships have to be inferred.