We compare predatory behaviour towards a mobile insect in three species of small mammals: the granivorous striped field mouse, the insectivorous common shrew and the Norway rat (a generalist). The striped field mouse displays a surprisingly efficient hunting stereotype. We apply the data compression method (Ryabko et al. Theory Comput Syst 52:133–147, 2013) to compare the complexity of hunting behavioural patterns and to evaluate the flexibility of stereotypes and their succinctness. Norway rats demonstrated the highest level of complexity of hunting behaviour, with the highest proportion of ‘auxiliary’ and ‘noise’ elements and relatively low proportion of ‘key’ elements in their behaviours. The predominance of ‘key’ elements resulted in similarly low levels of complexity of hunting stereotypes in striped field mice and shrews. The similarity between hunting stereotypes of the insectivorous shrew and the granivorous striped field mouse enables us to argue about evolutionary roots of hunting behaviour in small mammals. We show that this method is a useful tool for comparing ethograms as ‘biological texts’.