In the context of polynomials, the term 'factor' is unambiguous. But when it comes to functions, things get a bit murky.
For example:
The function $$f(x)=(x-1)^2 e^x$$ has $(x-1)^2$ being a 'factor'.
However, if we go by that, then this should also be true.
The function $$f(x)=(x-1)^2 \frac{1}{(x-1)^2} =1$$ has $(x-1)^2$ being a 'factor'.
Obviously the second example is a 'cheat' counter-example, but I am not absolutely certain how I can rigorously describe the expression $(x-1)^2$ in the function $f(x)=(x-1)^2 e^x$.
I am proposing the following extension of the definition of a factor, but will this do? Are there counter-examples?
Let $f(x) = (x-x_0) g(x)$, where $g(x)$ is a continuous function at $x=x_0$.
If this is satisfied, then we say that $(x-x_0)$ is a factor of $f(x)$.
To be honest, I believe what you are essentially trying to do is defined the order of vanishing of a function at some point $a$.
In short, you could say a function $f:\mathbb{R}\rightarrow \mathbb{R}$ has $\alpha>0$ order of vanishing at $a$ provided $a$ is an isolated zero of $f$ and \begin{align} \lim_{x\rightarrow a} \frac{f(x)}{|x-a|^\alpha} = \text{ nonzero constant }. \end{align}
In the theory of complex analysis, one could actually show the order of vanishing at a zero of an analytic function is actually of integer order.