I have the following structure.
>
You can do it with wrapAll:
wrapAll
var a = $('li'); do $(a.slice(0,3)).wrapAll(''); while((a = a.slice(3)).length>0)
example: http://jsfiddle.net/niklasvh/mZr4h/