The categorical imperative is an idea of Immanuel Kant's, the German philosopher from the late 1700s. It is, in his view, a moral law that applies to all people at all times. Kant formulated three ways of expressing the categorical imperative. The humanity formulation is one of them.
What Kant says in the humanity formulation is that people must always act in such a way that they treat others as ends in themselves, not as means to an end. What this means is that we must always treat other people as if they are important because of their humanity. We should not treat them as if they are simply tools to be used in an effort to get the things we want.
For example, let us say that my wife and children are starving and I have to decide whether to steal a loaf of bread from a store. I need to make my decision while thinking about the store owner as an important person. I cannot simply decide to use him as a tool to save my family. It is possible that I might still steal the bread. I might decide that it is better to steal the bread than to make the storeowner turn me down when I ask him. If I ask him for the bread, he might feel guilty so I might think that I should spare him that burden.
It is not clear if I would really be treating him as an end in himself, but I would at least be using the humanity formulation (rightly or wrongly) when I made this decision.