Gmail's spam and malware filters are among the best in the industry and block 99.9% of threats from reaching inboxes, according to Google. That doesn't mean there isn't room for improvement, as 0.1% can scale up to quite a substantial absolute number considering Gmail's big user base. Google has identified that malware in attachments (Office documents, in particular) tends to be dangerous due to its ever-changing nature, so it has developed an improved malware scanner that utilizes machine learning to stay ahead of the curve.
The new scanner has been launched at the end of 2019 and works alongside existing malware protection measures. Since the deployment, the developers have seen a 10% increase in malicious Office document detections, so the investment seems to be worthwhile. The scanner is even better when it comes to so-called "adversarial, bursty attacks" which are hard to tackle for machine-learning algorithms — detection rates for these have grown by 150%.
At the moment, the machine-learning scanner only checks Office documents, but Google says it's actively developing and improving the software, so it might expand to other, less targeted types of attachments in the future. You don't need to do anything to enjoy Gmail's enhanced protections — they should have rolled out to you automatically already and keep you safe from malware.