We present a formal description of a neurofuzzy system capable of aligning two sequences recognizing their internal structure. The alignment is done on two levels: grouping of the elements and alignment of groups. The system incorporates expert knowledge on both levels. Furthermore, it can be optimized by a learning algorithm adapted from the neural network domain. The system has been applied to the analysis of musical rhythm in the program RhythmScan which aligns rhythm patterns, e.g. for music tuition. This application is trained with data collected from real-life scenarios and it performs adequately on 97% of the used sample set.