In a nutshell
Multiplying a chain of matrices gives the same result no matter how you bracket it, but some bracketings need far fewer multiplications. This fills a table with the cheapest cost for every stretch of the chain, trying each split point, so the best way to parenthesize the whole product falls out at the end.