In grammar classes, you learned about the parts of speech: nouns, verbs, adjectives, prepositions, etc. These categories are a bit like the elements in the periodic table in chemistry. The subject called categorial grammar is an attempt to work out a branch of mathematics based on these parts of speech.
The basic idea is to replace the basic categories that we listed above by a more complicated set of categories based on the same ideas that work with fractions. For example, a Noun Phrase (NP) is something that can function as the subject of a sentence or as the object of a verb. Examples of NPs include
Here is where the first mathematical idea comes in.
We'll won't write Verb Phrase as VP but rather as a fraction:
S here stands for sentence. Now recall that one of the
basic ideas of fractions is cancellation: Similarly, In plain words, if we put a NP next to a VP, we get a
sentence. In symbols, we cancelled the two NP's.
The overall point is that there is a mathematics
of grammar that has something to do with ordinary fractions.
We said above that the basic categories are like the
elements in the periodic table of chemistry. This analogy is
right, but it has a certain flaw. The table from chemistry
can be discovered by evidence in the laboratory. Two good
scientists would discover the exact same elements. However,
to "discover"
the categories of grammar is much more of an art than a science.
It's largely up to the linguist to set up the basics of grammar.
And people can discuss and argue about the choices.