All three barcode types are capable of encoding GS1 Application Identifiers (AI) that encode data like GTIN, batch/lot number, use by date and serial number. How those AIs are encoded into the barcode change how they can be used.
GS1 DataMatrix is a variant of Data Matrix that uses GS1 element string syntax*, which is also used in other GS1 barcodes like GS1-128.
QR Code and Data Matrix use the GS1 Digital Link URI syntax* to put data into a web compatible format that also allows the information to be used for traditional supply chain applications like price lookup, while also connecting to the web.
QR Code is often used for consumer engagement because they are recognised by all smartphone cameras natively. Many existing implementations of QR Codes on-pack are now enabling proprietary experiences. Once they are repurposed to use GS1 Digital Link URI syntax, they will transform into multi-use barcodes that allow BOTH consumer engagement and price lookup, eliminating the need for multiple codes on pack.
DataMatrix can also be used to connect users to the web, but not all mobile device cameras can natively recognise them.
*Syntax means how things are arranged in a specific way to have meaning. GS1 currently have 4 different syntaxes.