Similarity measure for multivariate time series with heterogeous length and content
Try this recent paper: Consistent Algorithms for Clustering Time Series.

Your question is very much a current research topic.

Here's an older but excellent paper which talks about the fundamentals: Generalized Feature Extraction for Structural Pattern Recognition in Time-series Data.