category object in an (∞,1)-category, groupoid object
Let $L$ be a first order language and $T$ a theory over $L$. One can consider the category $\mathcal{M}_{el}(L)$ of structures over $L$ and elementary monomorphisms?. Define $\mathcal{M}_{el}(T)$ as a full subcategory of $\mathcal{M}_{el}(L)$, whose objects are models of $T$.
A definable groupoid over a theory $T$ is an internal groupoid in the category of definable sets and definable functions, i.e. the internal groupoid in the category of functors $\mathcal{M}_{el}(T)\to Set$. Similarly, for more general notion of a definable category over $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 (both up to equivalence.)
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