category object in an (∞,1)-category, groupoid object
In a model $M$ of a first-order theory $T$ a definable set $G$ might have additional algebraic stucture (e.g. that of a group, ring, groupoid, category, etc.) also given by definable functions and predicates. Since this set with extra structure is given by some collection of formulas in the language of $T$, it is interpreted in every model of $T$, and is hence an invariant of the syntactic category (walking model) $\mathbf{Def}(T)$ of $T$.
To make this precise:
Since groups, groupoids, rings, and categories can be given by algebraic theories, a definition (modulo having EI) of one of these in $T$ is just an interpretation of one of those theories in $T$ is just a logical functor from the walking models of one of these to $\mathbf{Def}(T)$.
Evaluating the unit of the Makkai duality adjunction at $T$ yields $\mathbf{Def}(T) \simeq \operatorname{Hom}_{\mathbf{Ult}}(\mathbf{Mod}(T), \mathbf{Set})$ the category of ultrafunctors? from the category of models (logical functors $\mathbf{Def}(T) \to \mathbf{Set}$) to $\mathbf{Set}$ viewed as ultracategories?, so that one may identify a definable set (and definable sets with extra definable structure on them) $X \in \mathbf{Def}(T)$ with a functor of points $M \mapsto X(M)$ on the category of models.
The fact that the external axiom of choice? (all epimorphisms split) holds in $\mathbf{Set}$ if and only if every fully faithful essentially surjective functor between small? categories is a true equivalence of categories can be word-for-word internalized to $\mathbf{Def}(T)$. This means: if the theory has two constants, then $T$ has definable Skolem functions if and only if every fully faithful essentially surjective definable functor between definable categories admits a pseudoinverse?.
With a suitable amount of choice (definable Skolem functions, for example) Freyd’s general adjoint functor theorem also carries over word-for-word to the setting of internal categories in $\mathbf{Def}(T)$.
In particular, there is much studied case of definable groups, cf. e.g. (Peterzil-Pillay)
There is a bijective correspondence between internal imaginary sorts of $T$ and definable concrete groupoids with a single isomorphism class, up to bi-interpretability over $T$ for the internal imaginary sorts and Hrushovski-equivalence for the definable concrete groupoids.
This is (Hrushovski 2006, Th.3.2).
Y. Peterzil, A. Pillay, S. Starchenko, Linear groups definable in o-minimal structures, J. Algebra 247 (2002), no. 1, pp. 1–23, MR1873380, doi
Alessandro Berarducci, Definable groups in o-minimal structures, pdf; Cohomology of groups in o-minimal structures: acyclicity of the infinitesimal subgroup, J. Symbolic Logic 74:3 (2009), 891-900, MR2548466, euclid, doi, O-minimal spectra, infinitesimal subgroups and cohomology, J. Symbolic Logic 72 (2007), no. 4, pp. 1177–1193, MR2371198, euclid, doi
Margarita Otero, A survey on groups definable in o-minimal structures, in: Model theory with applications to algebra and analysis. Vol. 2, 177–206, London Math. Soc. Lecture Note Ser. 350, Cambridge Univ. Press 2008, MR2010b:03042, doi
Ehud Hrushovski, Groupoids, imaginaries and internal covers (2006), arxiv/math.LO/0603413