This section is intended to assist the courts by providing a statutory interpretative rule when they are construing such Scottish legislation. Arguably, it does no more than replicate the normal common law rule of construction which the courts should apply when construing legislation which might be ultra vires, namely to seek, so far as it is possible to do so, to give effect to that legislation rather than invalidate it.  This is sometimes called the principle of efficacy.
For example an ASP which purports to confer a power on the Scottish Ministers to hold a referendum on any matter could be read as enabling the Ministers to hold a referendum on independence or the Monarchy.  Those are reserved matters and the ASP might therefore be read as relating to those reserved matters and therefore outside the legislative competence of the Parliament under section 29(2)(b). Rather than invalidating the ASP (or invalidating it to the extent that it could be so read), this section would require the ASP to be read, if it is possible to do so, as conferring a power to hold a referendum only on matters within the competence of the Parliament.  However, if a provision clearly cannot be read to be within competence, for example an ASP providing only for a referendum on independence, then the section will not allow it to be read as being within competence.
The section also provides that the interpretative provision should apply to the interpretation of the provisions of a Bill before the Scottish Parliament as well as to those of an ASP.  It will therefore apply in any case where the Judicial Committee of the Privy Council are considering any reference to them of a Bill or of a devolution issue in connection with an ASP.
There are other statutory interpretative rules which the courts are required to apply when construing such Scottish legislation. For example:
Commentary Part V: Miscellaneous and General General