To declare filter in SVG file

You use filter tag, precise units and filter effects region

<filter id="MyFilter" filterUnits="userSpaceOnUse" x="0" y="0" width="400" height="400">

In filter tag, you put filter primitive to use
You can redefine filter primitive effects region, give name to result of primitive, use as source ( in and in2 attributs ) result of other primitive or SourceGraphic, SourceAlpha, BackgroundImage, BackgroundAlpha, FillPaint, StrokePaint

By example:

<filter id="MyFilter" filterUnits="userSpaceOnUse" x="0" y="0" width="400" height="400">
    <feImage xlink:href='#MyImage' result='image'/>
    <feSpecularLighting id="fsl" lighting-color='white' result='spot' specularConstant ='1' specularExponent='16'> 
        <feSpotLight id='fsp' x='200' y='200' z='200' pointsAtX='200' pointsAtY='100' pointsAtZ='0' specularExponent='16' limitingConeAngle='45' />
    <feComposite id='fcp' in='image' in2='spot' operator="arithmetic" k1="0.5" k2="1" k3="1" k4="0"/>

In this example, we have:
feImage primitive refers to a graphic external, which is loaded or rendered into an RGBA raster and becomes the result of the filter primitive with name "image"
feSpecularLightning primitive using feSpotLight to define light source create RGBA raster with name "spot"
feComposite perform the composition of the two input images ( "image" and "spot" )